<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>题目提交</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <!--注意相对路径删除node_modules在实际服务器上跳转过程中是会变的，当前动态页面是要使用../来找到引入的资源,所以采用cdn-->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/layui/2.6.8/css/layui.css"  media="all">
    <script type="text/javascript" src="/constant.js"></script>
    <script type="text/javascript" src="/jquery/dist/jquery.min.js"></script>
    <script>
        /*判断用户是否登录*/
        // function CheckLogin() {
        var username = getCookie("username");
        var password = getCookie("password");
        console.log(username);
        console.log(password);
        //var information={user:username, passwd:password}; /*使用cookie传输*/
        $.ajax({
            type:'POST',
            // data:JSON.stringify(),
            contentType:'application/json',
            dataType:'text',
            url:'/CheckUserIfLogin',
            success:function (data) {
                console.log(data);
                /*说明cookie正确用户已经登录*/
                if (data == "true") {
                    console.log("true");
                    return;
                }
                else if(data == "false") {
                    console.log("false");
                    window.location.href= '/login.html';
                }
                else {
                    window.location.href= '/login.html';
                }
            }
        });
        // }
    </script>
</head>
<body>

<div class="layui-container">
    <div class="layui-row layui-col-space10">
        <div class="layui-col-md12">
            <div class="layui-col-md10">
                <ul class="layui-nav layui-bg-green" lay-filter="menu">
                    <li class="layui-nav-item"><a href="/index.html">YCOJ</a></li>
                    <li class="layui-nav-item layui-this"><a href="/index.html">Home</a></li>
                    <li class="layui-nav-item"><a href="/problem.html">Problem Set</a></li>
                    <li class="layui-nav-item"><a href="">Contest</a></li>
                    <li class="layui-nav-item"><a href="/status.html">Status</a></li>
                    <li class="layui-nav-item"><a href="">FAQ</a></li>
                    <li class="layui-nav-item">
                        <a href="javascript:;">个人中心</a>
                        <dl class="layui-nav-child"> <!-- 二级菜单 -->
                            <dd><a href="/submitLog.html">提交记录</a></dd>
                            <!--<dd><a href="">Modify</a></dd> 修改的页面放Userinfo里面-->
                            <dd><a href="/accountManageD.html">账号管理</a></dd>
                        </dl>
                    </li>
                </ul>
            </div>

            <div class="layui-col-md2">
                <ul class="layui-nav layui-bg-green">
                    <li class="layui-nav-item"><a href="login.html" >登录</a></li>
                    <li class="layui-nav-item"><a href="register.html">注册</a></li>
                </ul>
            </div>
        </div>


        <div class="layui-col-md12">
            <div class="layui-card-header layui-bg-blue" align="center">{{Name}}</div>
            <table class="layui-table" lay-even lay-skin="nob">
                <colgroup>
                    <col width="150">
                    <col width="200">
                    <col>

                    <h2 class = "layui-font-black">题目描述</h2>
                        <pre>
                        {{Description}}
                        </pre>

                        <form class="layui-form" method="post" id = "codeform" action="">
                            <h2 class = "layui-font-black">代码编写</h2>
                            <div class="layui-input-block">
                                <textarea name="code" required lay-verify="required" placeholder="提交代码" class="layui-textarea" style="height: 500px"></textarea>
                                <br>
                                <button class="layui-btn layui-btn-fluid " lay-submit="" lay-filter="CodeSubmit" >代码提交</button>
                            </div>
                        </form>

                        <!--<form class="layui-form" action="/datatest/{{id}}" method="post">
                            <h2 class="layui-font-black">输入数据</h2>
                            <div class="layui-input-block">
                                <textarea name="input" required lay-verify = "required" placeholder="请输入自测数据" class="layui-textarea"></textarea>
                                <br>
                                <button class="layui-btn layui-btn-fluid " lay-submit lay-filter="CodeTest" >调试</button>
                            </div>
                        </form>-->
                </colgroup>
            </table>
        </div>
    </div>
</div>

<script src="https://cdnjs.cloudflare.com/ajax/libs/layui/2.6.8/layui.js"></script>
<script>
    //注意：导航 依赖 element 模块，否则无法进行功能性操作
    layui.use('element', function(){
        var element = layui.element;//导航的hover效果、二级菜单等功能，需要依赖element模块
        //一些事件触发
        //监听导航点击的回调
        element.on('nav(menu)',function (elem) {
            //console.log(elem)
            layer.msg(elem.text());
        });
    });
</script>


<script src="https://cdnjs.cloudflare.com/ajax/libs/layui/2.6.8/layui.js"></script>
<script>
    layui.use('form', function (){
        var form = layui.form;
        document.getElementById("codeform").action="/compile/{{id}}";
        form.on('sumbit(CodeSubmit)',function (data) {
            layer.msg(JSON.stringify(data.field));
            return false;
        });
    });
</script>


<!--<script src="https://cdnjs.cloudflare.com/ajax/libs/layui/2.6.8/layui.js"></script>
<script>
    layui.use('form', function () {
        form.on('sumbit(CodeTest)',function (data) {
            layer.msg(JSON.stringify(data.field));
            return true;
        });
    });
</script>-->

<script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
<script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>


</body>
</html>
